package com.dream.keigezhushou.Activity.acty.personal;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.dream.keigezhushou.Activity.activity.BaseActivity;
import com.dream.keigezhushou.Activity.adapter.HomepageAdapter;
import com.dream.keigezhushou.Activity.view.CircleImageView;
import com.dream.keigezhushou.Activity.view.NestedScrollViewBottom;
import com.dream.keigezhushou.Activity.wigdt.GridSpacingItemDecoration;
import com.dream.keigezhushou.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PersonalHomepageActivity extends BaseActivity {

    @BindView(R.id.iv_user_pic)
    CircleImageView ivUserPic;
    @BindView(R.id.tv_user_nick)
    TextView tvUserNick;
    @BindView(R.id.iv_male1)
    ImageView ivMale1;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_number)
    TextView tvNumber;
    @BindView(R.id.tv_fans_number)
    TextView tvFansNumber;
    @BindView(R.id.tv_attention_number)
    TextView tvAttentionNumber;
    @BindView(R.id.scroll_bottom)
    NestedScrollViewBottom scrollBottom;
    @BindView(R.id.iv_return)
    ImageView ivReturn;
    @BindView(R.id.single_list)
    RecyclerView singleList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_homepage);
        ButterKnife.bind(this);

        initView();
        initData();
    }


    //初始化界面
    protected void initView() {

        //RecyclerView创建布局管理器
        singleList.setLayoutManager(new StaggeredGridLayoutManager(3,StaggeredGridLayoutManager.VERTICAL){
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        });

//        singleList.addItemDecoration(new DividerGridItemDecoration(this));
        int spacing = 24   ;

        singleList.addItemDecoration(new GridSpacingItemDecoration(3,spacing,true));
        singleList.setHasFixedSize(true);
        singleList.setFocusable(false);
        //RecyclerView创建适配器
        singleList.setAdapter(new HomepageAdapter(this));

    }

    //初始化数据
    protected void initData() {

        ivReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                //返回
                finish();
            }
        });

        //滑动的监听
        scrollBottom.setScrollBottomListener(new NestedScrollViewBottom.ScrollBottomListener() {
            @Override
            public void scrollBottom() {

            }
        });
    }
}
